import http from '@/utils/request'
export default {
  login: {
    url: `api/user/login`,
    name: '登录',
    post: async function (data) {
      return await http.post(this.url, data)
    }
  },
  queryWithPage: {
    url: `api/user/query-with-page`,
    name: '用户管理表-分页查询',
    post: async function (data) {
      return await http.post(this.url, data)
    }
  },
  save: {
    url: `api/user/save`,
    name: '用户管理表-新增',
    post: async function (data) {
      return await http.post(this.url, data)
    }
  },
  modify: {
    url: `api/user/modify`,
    name: '用户管理表-修改',
    post: async function (data) {
      return await http.post(this.url, data)
    }
  },
  empower: {
    url: `api/user/empower`,
    name: '用户管理表-赋权',
    post: async function (data) {
      return await http.post(this.url, data)
    }
  },
  delete: {
    url: `api/user/delete/`,
    name: '用户管理表-删除',
    get: async function (data) {
      return await http.get(this.url + data)
    }
  },
  deleteBatch: {
    url: `api/user/delete-batch`,
    name: '用户管理表-批量删除',
    post: async function (data) {
      return await http.post(this.url, data)
    }
  },
  changeInvalid: {
    url: `api/user/change-status/`,
    name: '用户管理表-更改状态',
    get: async function (data) {
      return await http.get(this.url + data)
    }
  },
  queryById: {
    url: `api/user/`,
    name: '用户管理表-查询',
    get: async function (data) {
      return await http.get(this.url + data)
    }
  },
  resetPassword: {
    url: `api/user/reset-password/`,
    name: '用户管理表-重置密码',
    get: async function (data) {
      return await http.get(this.url + data)
    }
  },
  exportData: {
    url: `api/user/export-excel`,
    name: '用户管理表-导出',
    post: async function (data) {
      return await http.down(this.url, data, {headers: {
					'Content-Type': 'application/json;charset=UTF-8',
          exportFlag: '1',
          channelCode: 'C01'
				},method: 'post'})
    }
  },
  importData: {
    url: `api/excel-tmpl/download-excel-tmpl/`,
    name: '用户管理表-导入',
    down: async function (id, data = {}) {
      return await http.down(`${this.url}${id}`, data, 
       {headers: {
					'Content-Type': 'application/json;charset=UTF-8',
          exportFlag: '1',
          channelCode: 'C01'
				},method: 'get'}
      )
    }
  },
  removeAva: {
    url: `api/user/remove-ava`,
    name: '移除用户头像',
    get: async function (param) {
      return await http.get(this.url, param)
    }
  }
}